package com.jlpay.openapi.demo.openmerch.wechat;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.wechat.request.RealnameWxQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.wechat.response.RealnameWxQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author chenjunhong
 * @since 2024/3/25
 */
public class WechatRealnameQueryService {

    private static final Logger LOGGER = LoggerFactory.getLogger(WechatRealnameQueryService.class);

    public static void main(String[] args) {
        RealnameWxQueryRequest realnameWxQueryRequest = buildRealnameWxQueryRequest();
        RealnameWxQueryResponse realnameWxQueryResponse = JlpayOpenApiService.openMerchService()
                .post(realnameWxQueryRequest, RealnameWxQueryResponse.class);
        LOGGER.info("微信实名认证查询响应:{}", JsonUtils.toString(realnameWxQueryResponse));
    }

    private static RealnameWxQueryRequest buildRealnameWxQueryRequest() {
        RealnameWxQueryRequest realnameWxQueryRequest = new RealnameWxQueryRequest();
        // 商户号
        realnameWxQueryRequest.setMerchNo("849584358140020");
        // 查询类型，0-申请单查询（默认），1-授权结果查询
        realnameWxQueryRequest.setQueryType("0");
        return realnameWxQueryRequest;
    }

}
